VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form FTipoCambioOpt 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Tipo de Cambio"
   ClientHeight    =   2670
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3615
   Icon            =   "FTipoCambioOpt.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2670
   ScaleWidth      =   3615
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox txtMoneda 
      BackColor       =   &H8000000F&
      Height          =   285
      Left            =   1200
      Locked          =   -1  'True
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   240
      Width           =   1695
   End
   Begin VB.TextBox txtCambio 
      Height          =   285
      Left            =   1200
      MaxLength       =   10
      TabIndex        =   5
      Top             =   1440
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker cmbFecha 
      Height          =   315
      Left            =   1200
      TabIndex        =   3
      Top             =   840
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   59899905
      CurrentDate     =   38935
   End
   Begin MSForms.CommandButton CmdAceptar 
      Height          =   375
      Left            =   240
      TabIndex        =   6
      Top             =   2040
      Width           =   1455
      Caption         =   " Aceptar"
      PicturePosition =   327683
      Size            =   "2566;661"
      Picture         =   "FTipoCambioOpt.frx":058A
      Accelerator     =   65
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton CmdCancelar 
      Height          =   375
      Left            =   1920
      TabIndex        =   7
      Top             =   2040
      Width           =   1455
      Caption         =   " Cancelar"
      PicturePosition =   327683
      Size            =   "2566;661"
      Picture         =   "FTipoCambioOpt.frx":06E4
      Accelerator     =   67
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin VB.Label Label3 
      Alignment       =   1  'Right Justify
      Caption         =   "T.C.:"
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   1440
      Width           =   615
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "Fecha:"
      Height          =   255
      Left            =   480
      TabIndex        =   2
      Top             =   840
      Width           =   615
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Caption         =   "Moneda:"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "FTipoCambioOpt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents monedas As ClsMoneda
Attribute monedas.VB_VarHelpID = -1
Private WithEvents tipoca As ClsTipoCambio
Attribute tipoca.VB_VarHelpID = -1
Private final As Integer
Private numero As Integer
Private listamonedas() As Integer
Private modo As Integer
Private kind As Integer

Private Sub CmdAceptar_Click()
    
    If modo = 1 Then
        If txtCambio.Text <> "" Then
            Select Case kind
                Case 0: tipoca.Nuevo monedas.cod, CambiaFecha(cmbFecha.value, True), txtCambio.Text
                Case 1: tipoca.Modificar tipoca.codigo, monedas.cod, CambiaFecha(cmbFecha.value, True), txtCambio.Text
            End Select
            'FTipoCambio.cargaMonedas
            Unload Me
        End If
    End If
    
    If modo = 2 Then
        If txtCambio.Text <> "" Then
            'actualiza tipo de cambio
            'MsgBox cmbFecha.Value
            tipoca.Nuevo (listamonedas(numero)), CambiaFecha(cmbFecha.value, True), txtCambio.Text
            'carga nueva moneda que no tenga tipo de cambio de hoy
            numero = numero + 1
            monedas.consultaDatos (listamonedas(numero))
            txtMoneda.Text = monedas.nombre
            If numero >= final Then
                Unload Me
            End If
        End If
    End If
End Sub

Private Sub CmdCancelar_Click()
    Unload Me
End Sub

Private Sub CmdOk_Click()

End Sub

Private Sub Form_Load()
    Set monedas = New ClsMoneda
    Set tipoca = New ClsTipoCambio
    'txtCambio.SetFocus
    cmbFecha.value = FechaHoyServidor
    'cmbFecha.Value = CambiaFecha(obtieneFecha, False)
    modo = 1
End Sub

Private Sub tipoca_DataChanged()
    cmbFecha.value = CambiaFecha(tipoca.fecha, False)
    monedas.consultaDatos tipoca.codMoneda
    monedas.orset.CierraRec
    txtMoneda.Text = monedas.nombre
    txtCambio.Text = tipoca.cambio
End Sub

Private Sub txtCambio_GotFocus()
    MUtiles.seleccionaTexto txtCambio
End Sub

Private Sub txtCambio_KeyDown(KeyCode As Integer, Shift As Integer)
    keyCodigo = KeyCode
    'MsgBox keycode
End Sub

Private Sub txtCambio_KeyPress(KeyAscii As Integer)
    KeyAscii = NroDecimal(txtCambio, KeyAscii)
End Sub
Public Sub opcionNuevo()
    kind = 0
    Caption = "Tipo de Cambio - Adicionar"
    txtCambio.Text = "0.00"
End Sub
Public Sub cargaDatos(codig As String)
    kind = 1
    Caption = "Tipo de Cambio - Modificar"
    tipoca.consultaDatos codig
End Sub
Public Sub cargaDatoMoneda(codmone As String)
    Me.txtMoneda.Text = ""
    monedas.consultaDatos codmone
    'monedas.CierraRec
    txtMoneda.Text = monedas.nombre_moneda
End Sub

Public Sub cargaMonedas(num As Integer, codmonedas() As Integer)
    Me.txtMoneda.Text = ""
    modo = 2
    numero = 0
    final = num
    ReDim listamonedas(num) As Integer
    listamonedas = codmonedas
    monedas.consultaDatos (listamonedas(numero))
    txtMoneda.Text = monedas.nombre
End Sub

